package cn.vc.auth.config;

import cn.vc.auth.util.EmailUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration
@Import({EmailUtil.class})
public class MyWebConfig {
    // 密码编码器
    @Bean
    public PasswordEncoder passwordEncoder() {
        //密码为明文方式
//        return NoOpPasswordEncoder.getInstance();
        // 使用默认的BCryptPasswordEncoder加密方案
        return new BCryptPasswordEncoder();
    }

//    @Bean
//    public ControllerInterceptor controllerInterceptor() {
//        return new ControllerInterceptor();
//    }

//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(controllerInterceptor()).addPathPatterns("/user/**", "/relation/**");
//    }

//    @Override
//    public void addViewControllers(ViewControllerRegistry registry) {
//        registry.addViewController("/").setViewName("redirect:/login-view");
//        registry.addViewController("/login-view").setViewName("login");
//    }
}
